package com.baizhi.controller;

import com.baizhi.entity.BzAdmin;
import com.baizhi.service.IBzAdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Controller
@RequestMapping("admin")
public class BzAdminController {
    @Autowired
    private IBzAdminService adminService;

    @ResponseBody
    @RequestMapping("selectAll")
    public List<BzAdmin> selectAll(){
        return adminService.list();
    }

    @ResponseBody
    @RequestMapping("failureRedirectUrl")
    public String failureRedirectUrl(){
        /**
         * 获取ThreadLocal中的异常信息
         *
         * ThreadLocal 的信息用完一定要删除
         */
        return "redirect:/login.jsp";
    }


    @ResponseBody
    @RequestMapping("successRedirectUrl")
    public String successRedirectUrl(){
        return "redirect:/main.jsp";
    }
}
